<?php

namespace app\listing\controller;
use app\common\controller\PCBase;
use app\listing\logic\ListingLogic;
use Throwable;
use  think\App;
class ListingProduct extends PCBase
{


    /**
     * @desc    在线产品列表
     * @author  luckyXiong
     * @date    2024-12-24
     */
    public function index()
    {
        $params     = $this->request->post();
        return  (new ListingLogic())->getProductList($params);
    }


    /**
     * @desc    获取spu详情信息接口
     * @author  luckyXiong
     * @date    2024-12-24
     */
    public function get_sku_list()
    {
        $params     = $this->request->post();
        return  (new ListingLogic())->get_sku_list($params);
    }


    /**
     * @desc    获取出单店铺信息
     * @author  luckyXiong
     * @date    2024-12-24
     */
    public function getListingShop(){
        $params     = $this->request->post();
        $keyword    = $params['keyword']??'';
        if($keyword){
            $params['name'] = $keyword;
        }
        return  (new ListingLogic())->getListingShop($params);
    }

    /**
     * @desc    导入产品到店铺
     * @author  luckyXiong
     * @date    2024-12-27
     */
    public function syncListShop(){
        $params     = $this->request->post();
        return  (new ListingLogic())->syncListShop($params);
    }

    /**
     * @desc    获取出单店铺信息
     * @author  luckyXiong
     * @date    2024-12-24
     */
    public function get_collections(){
        $params     = $this->request->post();
        $keyword    = $params['keyword']??'';
        if($keyword){
            $params['name'] = $keyword;
        }
        return  (new ListingLogic())->get_collections($params);
    }

    /**
     * @desc    获取在线店铺信息接口
     * @author  luckyXiong
     * @date    2024-12-25
     */
    public function add(){
        $params   = $this->request->post();
        return  (new ListingLogic())->add_product($params);
    }


    /**
     * @desc    获取在线产品详情接口
     * @author  luckyXiong
     * @date    2024-12-25
     */
    public function getInfo(){
        $params   = $this->request->post();
        return  (new ListingLogic())->getInfo($params);
    }


    /**
     * @desc    创建在线产品接口
     * @author  luckyXiong
     * @date    2024-12-25
     */
    public function edit(){
        $params   = $this->request->post();
        return  (new ListingLogic())->edit_product($params);
    }


    /**
     * @desc    删除模版产品接口
     * @author  luckyXiong
     * @date    2024-12-27
     */
    public function delete_product(){
        $params   = $this->request->post();
        return  (new ListingLogic())->delete_product($params);
    }


    /**
     * @desc    同步在线产品消费方法
     * @author  luckyXiong
     * @date    2024-12-28
     */
    public function copy_product_consumer(){
        $params   = $this->request->post();
        $res      = (new ListingLogic())->copy_product_consumer($params);
        return  $this->jsonMessage(200,true,'获取成功',$res);
    }







}